import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12

Window {
    id: window
    visible: true
    width: 640
    height: 480
    title: qsTr("Qt Activity handler")

    property string status: "Return status: "
    Text {
        id: resultText
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        font.pointSize: 20
        text: status + "not started"
    }

    Button {
        text: "Start custom Android activity"
        anchors.verticalCenterOffset: 100
        anchors.verticalCenter: parent.verticalCenter
        anchors.horizontalCenter: parent.horizontalCenter
        onClicked: activityHandler.showSecondActivity()
    }

    Connections {
        target: activityHandler
        function onReceiveFromActivityResult(message) {
            resultText.text = status + message
        }
    }
}